﻿using System;
using System.Collections.Generic;

using System.Text;

namespace Rance.Battle
{
    public class 攻击Behavior : IBehavior
    {
        public 角色Struct 角色 { get; set; }
        public 角色Struct? 守护角色 { get; set; }

        public 发动守护Behavior 发动守护Behavior { get; set; }

        public 发动护盾Behavior 发动护盾Behavior { get; set; }
        public 伤害Behavior 伤害Behavior { get; set; }
        public 吸血Behavior 吸血Behavior { get; set; }
        public 败退Behavior 败退Behavior { get; set; }
        public 打断Behavior 打断Behavior { get; set; }

        public 反击Behavior 反击Behavior { get; set; }
        public 发动护盾Behavior 反击发动护盾Behavior { get; set; }
        public 伤害Behavior 反击伤害Behavior { get; set; }
        public 吸血Behavior 反击吸血Behavior { get; set; }
        public 败退Behavior 反击败退Behavior { get; set; }

        public 战果Behavior 战果Behavior { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(string.Format("    对{0}攻击,",角色));
            if(发动守护Behavior != null)
                sb.Append(string.Format("{0},", 发动守护Behavior));
            if(发动护盾Behavior != null)
                sb.Append(string.Format("{0}.", 发动护盾Behavior));
            else if (伤害Behavior != null)
            {
                sb.Append(string.Format("{0}.", 伤害Behavior));
                if(吸血Behavior != null)
                    sb.Append(string.Format("{0}.", 吸血Behavior));
            }

            if (打断Behavior != null)
                sb.Append(string.Format("{0}.", 打断Behavior));
            if(败退Behavior != null)
                sb.Append(string.Format("{0}.", 败退Behavior));

            if(反击Behavior != null)
                if(守护角色 != null)
                    sb.Append(string.Format("{0}反击,", 守护角色));
                else
                    sb.Append(string.Format("{0}反击,", 角色));

            if (反击发动护盾Behavior != null)
                sb.Append(string.Format("{0}.", 反击发动护盾Behavior));
            else if (反击伤害Behavior != null)
            {
                sb.Append(string.Format("{0}.", 反击伤害Behavior));
                if (反击吸血Behavior != null)
                    sb.Append(string.Format("{0}.", 反击吸血Behavior));
            }
            if (反击败退Behavior != null)
                sb.Append(string.Format("{0}.", 反击败退Behavior));


            sb.Append(string.Format("{0}.", 战果Behavior));

            return sb.ToString();
        }
    }
}
